/**
 * @description 问卷组件  ---段落
 * @author 大肘子
 */

import React, { FC } from "react";
import { QuestionParagraphType, QuestionParagraphDefaultValue } from "./type";
import { Typography } from "antd";
const { Paragraph } = Typography;
const QuestionParagraphComponent: FC<QuestionParagraphType> = (props) => {
  const { title = "", iscenter } = { ...QuestionParagraphDefaultValue, ...props };
  const titleList = title.split("\n");
  return (
    <Paragraph style={{ textAlign: iscenter ? "center" : "start" }}>
      {titleList.map((item, index) => {
        return (
          <span key={index}>
            {index > 0 ? <br /> : null}
            {item}
          </span>
        );
      })}
    </Paragraph>
  );
};

export default QuestionParagraphComponent;
